<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
	"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
	"http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>

    <constant name="struts.devMode" value="false" />

	<package name="shop" extends="struts-default" namespace="/">

		<!-- 拦截器配置 -->
		<interceptors>
			<interceptor name="privilegeInterceptor" class="privilegeInterceptor" />
		</interceptors>

		<global-results>
			<result name="msg">/WEB-INF/jsp/msg.jsp</result>
			<result name="login">/WEB-INF/jsp/login.jsp</result>
			<result name="loginFail">/admin/index.jsp</result>
		</global-results>
		<!-- 配置首页访问的Action -->
		<action name="index" class="indexAction">
			<result name="index">/WEB-INF/jsp/index.jsp</result>
		</action>

		<!-- 配置用户模块的Actin -->
		<action name="user_*" class="userAction" method="{1}">
			<result name="registPage">/WEB-INF/jsp/regist.jsp</result>
			<result name="input">/WEB-INF/jsp/regist.jsp</result>
			<result name="loginPage">/WEB-INF/jsp/login.jsp</result>
			<result name="login">/WEB-INF/jsp/login.jsp</result>
			<result name="loginSuccess" type="redirectAction">index</result>
			<result name="quit" type="redirectAction">index</result>
		</action>

		<!-- 验证码的Action -->
		<action name="checkImg" class="checkImgAction">

		</action>

		<!-- 商品模块的Action -->
		<action name="product_*" class="productAction" method="{1}">
			<result name="findByPid">/WEB-INF/jsp/product.jsp</result>
			<result name="findByCid">/WEB-INF/jsp/productList.jsp</result>
			<result name="findByCsid">/WEB-INF/jsp/productList.jsp</result>
		</action>

		<!-- 购物车的Action -->
		<action name="cart_*" class="cartAction" method="{1}">
			<result name="addCart">/WEB-INF/jsp/cart.jsp</result>
 			<result name="clearCart">/WEB-INF/jsp/cart.jsp</result>
			<result name="removeCart">/WEB-INF/jsp/cart.jsp</result>
			<result name="myCart">/WEB-INF/jsp/cart.jsp</result>
		</action>

		<!-- 订单的Action -->
		<action name="order_*" class="orderAction" method="{1}">
			<result name="saveSuccess">/WEB-INF/jsp/order.jsp</result>
			<result name="findByUidSuccess">/WEB-INF/jsp/orderList.jsp</result>
			<result name="findByOidSuccess">/WEB-INF/jsp/order.jsp</result>
			<result name="updateStateSuccess" type="redirectAction">order_findByUid.action?page=1</result>
		</action>

		<!-- 后台登录管理的Action -->
		<action name="adminUser_*" class="adminUserAction" method="{1}">
			<result name="loginFail">/admin/index.jsp</result>
			<result name="loginSuccess" type="redirect">/admin/home.jsp</result>
		</action>

		<!-- 配置后台一级分类管理的Action -->
		<action name="adminCategory_*" class="adminCategoryAction" method="{1}">
			<result name="findAll">/admin/category/list.jsp</result>
			<result name="saveSuccess" type="redirectAction">adminCategory_findAll.action</result>
			<result name="deleteSuccess" type="redirectAction">adminCategory_findAll.action</result>
			<result name="editSuccess">/admin/category/edit.jsp</result>
			<result name="updateSuccess" type="redirectAction">adminCategory_findAll.action</result>

			<!-- 引用拦截器 -->
			<interceptor-ref name="privilegeInterceptor" />
			<interceptor-ref name="defaultStack" />

		</action>

		<!-- 配置后台二级分类管理的Action -->
		<action name="adminCategorySecond_*" class="adminCategorySecondAction" method="{1}">
			<result name="findAllByPageSuccess">/admin/categorysecond/list.jsp</result>
			<result name="addPageSuccess">/admin/categorysecond/add.jsp</result>
			<result name="saveSuccess" type="redirectAction">adminCategorySecond_findAllByPage.action?page=1</result>
			<result name="deleteSuccess" type="redirectAction">adminCategorySecond_findAllByPage.action?page=1</result>
			<result name="editSuccess">/admin/categorysecond/edit.jsp</result>
			<result name="updateSuccess" type="redirectAction">adminCategorySecond_findAllByPage.action?page=1</result>

			<!-- 引用拦截器 -->
			<interceptor-ref name="privilegeInterceptor" />
			<interceptor-ref name="defaultStack" />

		</action>

		<!-- 配置后台商品管理的Action -->
		<action name="adminProduct_*" class="adminProductAction" method="{1}">
			<result name="findAll">/admin/product/list.jsp</result>
			<result name="addSuccess">/admin/product/add.jsp</result>
			<result name="saveSuccess" type="redirectAction">adminProduct_findAllByPage.action?page=1</result>
			<result name="deleteSuccess" type="redirectAction">adminProduct_findAllByPage.action?page=1</result>
			<result name="editSuccess">/admin/product/edit.jsp</result>
			<result name="updateSuccess" type="redirectAction">adminProduct_findAllByPage.action?page=1</result>

			<!-- 引用拦截器 -->
			<interceptor-ref name="privilegeInterceptor" />
			<interceptor-ref name="defaultStack" />

		</action>

		<!-- 配置后台订单管理的Action -->
		<action name="adminOrder_*" class="adminOrderAction" method="{1}">
			<result name="findAllSuccess">/admin/order/list.jsp</result>
			<result name="itemSuccess">/admin/order/orderItem.jsp</result>
			<result name="updateStateSuccess" type="redirectAction">adminOrder_findAll.action?page=1</result>

			<!-- 引用拦截器 -->
			<interceptor-ref name="privilegeInterceptor" />
			<interceptor-ref name="defaultStack" />

		</action>

	</package>

</struts>
